import { lazy } from 'react'
import { useRoutes } from 'react-router-dom'

const Login = lazy(() => import('@/pages/login/index'))
const Home = lazy(() => import('@/pages/home/index'))
const Resource = lazy(() => import('@/pages/resource/index'))
const UserInfo = lazy(() => import('@/pages/userInfo/index'))
const Store = lazy(() => import('@/pages/store/index'))
const StoreInventory = lazy(() => import('@/pages/store/inventory/index'))
const StoreQuality = lazy(() => import('@/pages/store/storeQuality/index'))
const Preordered = lazy(() => import('@/pages/store/preordered/index'))
const CarOwner = lazy(() => import('@/pages/carOwner/carOwner/index'))
const CarOwnerQuality = lazy(
  () => import('@/pages/carOwner/carOwnerQuality/index')
)
const CarOwnerInsurance = lazy(
  () => import('@/pages/carOwner/carOwnerInsurance/index')
)
const QuotationManagement = lazy(
  () => import('@/pages/quotationManagement/index')
)
const Qualit = lazy(() => import('@/pages/quality/index'))
const Insurance = lazy(() => import('@/pages/insurance/index'))
const Shopping = lazy(() => import('@/pages/shopping/index'))
const AddApplet = lazy(() => import('@/pages/addApplet/index'))
const NumberPage = lazy(() => import('@/pages/number/index'))
const routers = [
  {
    path: '/',
    element: <Login />
  },
  {
    path: '/login',
    element: <Login />
  },
  {
    path: '/home/*',
    element: <Home />,
    children: [
      {
        path: 'resource',
        element: <Resource />
      },
      {
        path: 'number',
        element: <NumberPage />
      },
      {
        path: 'userinfo',
        element: <UserInfo />
      },
      {
        path: 'addApplet',
        element: <AddApplet />
      },
      {
        path: 'store',
        element: <Store />,
        children: []
      },
      {
        path: 'storeinventory',
        element: <StoreInventory />
      },
      {
        path: 'storequality',
        element: <StoreQuality />
      },
      {
        path: 'preordered',
        element: <Preordered />
      },
      {
        path: 'carOwner',
        element: <CarOwner />
      },
      {
        path: 'carOwnerQuality',
        element: <CarOwnerQuality />
      },
      {
        path: 'carOwnerInsurance',
        element: <CarOwnerInsurance />
      },
      {
        path: 'quotationManagement',
        element: <QuotationManagement />
      },
      {
        path: 'qualit',
        element: <Qualit />
      },
      {
        path: 'insurance',
        element: <Insurance />
      },
      {
        path: 'shopping',
        element: <Shopping />
      }
    ]
  }
]

function App() {
  return useRoutes(routers)
}
export default App
